Imports myBookmarks.Core
Imports myBookmarks.Infrastructure
Imports myBookmarks.Data
Imports System.IO
Namespace myBookmarks.Web
    Public Class BookmarkBaseController
        Inherits BaseController
        Private _bookmarkRepository As IBookmarkRepository

        Public Sub New(ByVal userservice As IUserService, ByVal bookmarkRepository As IBookmarkRepository, ByVal settings As IConfigurationSettings)
            MyBase.New(userservice, settings)
            _bookmarkRepository = bookmarkRepository
        End Sub
        Public Function CreateBookmarkViewModel(Of T As {BaseBookmarkViewModel, New})() As T
            Dim viewData As T = CreateViewModel(Of T)()
            viewData.UserLabels = _bookmarkRepository.GetLabels(CurrentUserName)
            viewData.LabelCountByBookmarks = _bookmarkRepository.GetLabelsWithBookmarkCount(CurrentUserName)
            Return viewData
        End Function
    End Class
End Namespace